//
//  ITNetWorkModel.m
//  Walk
//
//  Created by seven on 2020/9/8.
//  Copyright © 2020 seven. All rights reserved.
//

#import "ITNetWorkModel.h"

@implementation ITNetWorkModel


- (void)setFinishTime:(CGFloat)finishTime{
    _finishTime = finishTime;
    _coast = _finishTime - _encodeTime;
    
    int time = _coast*1000;
    NSLog(@"url = %@ request coast %d",_url, time);
    
    NSDictionary *params = @{
        @"result": _success ? @"1": @"0",
        @"url": _url,
        @"http_status_code": @(_statusCode).stringValue,
        @"status_code": @(_code).stringValue,
        @"response_duration": @(time),
        @"overtime": _coast > 10 ? @"1" : @"2",
    };
    [ITTrackManager trackMTAEventNo:@"vq_00024" parameters:params];
}

- (void)setEncodeTime:(CGFloat)encodeTime{
    _encodeTime = encodeTime;
    _encodeCoast = _encodeTime - _beginTime;
    
    //*
    int time = _encodeCoast*1000;
    NSLog(@"url = %@ encode coast %d",_url, time);
    
    
    NSDictionary *params = @{
        //@"url": _url,
        @"status": @"encode finish",
        @"coast": @(time),
    };
    [ITTrackManager trackMTAEventNo:@"vq_00025" parameters:params];
     //*/
}

- (void)setDecodeTime:(CGFloat)decodeTime{
    _decodeTime = decodeTime;
    _decodeCoast = _decodeTime-_finishTime;
    
    //*
    int time = _decodeCoast*1000;
    
    NSLog(@"url = %@ decode coast %d",_url, time);
    
    NSDictionary *params = @{
        //@"url": _url,
        @"status": @"decode finish",
        @"coast": @(time),
    };
    [ITTrackManager trackMTAEventNo:@"vq_00025" parameters:params];
     //*/
}

@end
